home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
comm
/
mail
/
AM119src.lha
/
strip7.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-17
|
2KB
|
77 lines
/*
*
* AM --- AmigaMail
* (C) 1991, 1992 by Christian Riede
*
* AM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY. No author or distributor accepts responsibility to anyone
* for the consequences of using it or for whether it serves any
* particular purpose or works at all, unless he says so in writing.
* Refer to the GNU General Public License, Version 1, for full details.
*
* Everyone is granted permission to copy, modify and redistribute AM,
* but only under the conditions described in the GNU General Public
* License, Version 1. A copy of this license is supposed to have been
* given to you along with AM so you can know your rights and responsi-
* bilities. It should be in a file named COPYING. Among other things,
* the copyright notice and this notice must be preserved on all copies.
*
*
*
*/
#include "am.h"
#include "config.h"
/* translate 8bit iso8859-1 chars to 7bit where possible */
/* please feel free to send additions to the list below */
/* to the author, chr@senga.ka.sub.org */
/* thanks to Markus Kuhn <mskuhn@immd4.informatik.uni-erlangen.de> */
static char *iso2asc[96] = {
" ","!","c","?","?","Y","|","?","\"","(c)","a","<<","?","-","(R)"," ",
"?","+/-","2","3","'","mu","P",".",",","1","o",">>","1/4","1/2","3/4","?",
"A","A","A","A","Ae","A","AE","C","E","E","E","E","I","I","I","I",
"D","N","O","O","O","O","Oe","x","O","U","U","U","Ue","Y","P","ss",
"a","a","a","a","ae","a","ae","c","e","e","e","e","i","i","i","i",
"d","n","o","o","o","o","oe",":","o","u","u","u","ue","y","p","y"
};
static void dostrip7(int c,FILE *out,int *you_have_been_warned)
{
if (c<128)
fputc(c,out);
else if (c>=0xa0)
fputs(iso2asc[c - 0xa0],out);
else
{
fputc(c,out);
if (!*you_have_been_warned)
{
*you_have_been_warned=TRUE;
SimpleRequest(Window,"7BIT mail contains nonconvertible non ASCII characters!");
}
}
}
void strip7(FILE *in,FILE *out)
{
int c;
int you_have_been_warned=FALSE;
while ((c=getc(in))!=EOF)
dostrip7(c,out,&you_have_been_warned);
}
void linestrip7(UBYTE *Buf,int len,FILE *out)
{
int you_have_been_warned=FALSE;
while (len-->0)
dostrip7(*Buf++,out,&you_have_been_warned);
}